import json

import requests

def get_ip_location(ip):
	url = f"http://ip.taobao.com/outGetIpInfo?ip={ip}&accessKey=alibaba-inc"
	r = requests.get(url)
	data = json.loads(r.text)
	country, region, city, isp = (
		data["data"]["country"],
		data["data"]["region"],
		data["data"]["city"],
		data["data"]["isp"],
	)
	return country, region, city, isp

print(get_ip_location("58.250.137.36"))
print(get_ip_location("220.181.38.148"))

